package com.baiyue.mapper;

import com.baiyue.entity.ProductCategory;
import com.baiyue.model.SelectOptionsResult;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 *
 * @author 伍波
 * @date 2024-06-16
 */
@Mapper
public interface ProductCategoryMapper extends BaseMapper<ProductCategory> {
    List<SelectOptionsResult> findIdAndName();

    Integer deleteCategoryByIds(Map<String,Object> paramMap);

    @Select({
            "select",
            "*",
            "from product_category",
            "where category_name = #{categoryName} and status != 1"
    })
    ProductCategory findByCategoryName(String productCategoryName);

    List<ProductCategory> findByPage(ProductCategory productCategory, Pagination page);
}
